package day1104.demo02;

import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-04 09:54
 **/
public class Test03 {
    public static void main(String[] args) {

        //无参，返回学生对象的名称
        Student s=new Student("张三","19");

        //观察该lambda表达式: 对象名.实例方法（）。
//        Supplier<String> supplier=()->s.getName();
        //方法引用
        Supplier<String> supplier=s::getName;


        System.out.println(supplier.get());


    }
}
class Student{
     private String name;
     private String age;

    public Student(String name, String age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }
}
